<?php
    /**
     * Created by PhpStorm.
     * User: zgh
     * Date: 2021-07-29
     * Time: 14:17
     */

    namespace app\admin\validate;


    use think\Validate;

    class SysConfigValidate extends Validate
    {
        protected $rule = [
            'site_icon|图标' => 'checkIcon',
        ];

        protected function checkIcon($value)
        {
            if (!empty($value)) {
                if (strrpos($value, "ico") !== false || strrpos($value, "icon")) {
                    return true;
                } else {
                    return '请上传正确的icon文件格式';
                }
            } else {
                return true;
            }
        }


    }